package com.itheima.d7_generics_interface;



import java.util.ArrayList;

public class Studentjiek implements Demoo<Student> {
    @Override
    public void manage(ArrayList<Student> stu) {
        int count1 = 0;
        int count2 = 0;
        for (int i = 0; i < stu.size(); i++) {
            Student student = stu.get(i);
            System.out.println(student.getName() + " " + student.getGender() + " " + student.getScore());
            if (student.getGender() == '男') {
                count1++;
            } else {
                count2++;

            }
        }
        System.out.println("男：" + count1);
        System.out.println("女：" + count2);
    }

    @Override
    public void putScore(ArrayList<Student> stu) {
        double maxscore = stu.get(0).getScore();
        double minscore = stu.get(0).getScore();
        double allscore = 0;
        for (int i = 0; i < stu.size(); i++) {
            Student student = stu.get(i);
            allscore += student.getScore();
            if (maxscore < student.getScore()) {
                maxscore = student.getScore();
            }
            if (minscore > student.getScore()) {
                minscore = student.getScore();
            }
        }
        System.out.println("最高分："+maxscore);
        System.out.println("最低分："+minscore);
        System.out.println("减去最高分和最低分平均成绩：" + (allscore-minscore-maxscore) / (stu.size()-2));
    }
}
